<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改网站首页展示目录')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-title-edit" th:object="${websiteTitle}">
            <input name="titleId" th:field="*{titleId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">父级标题：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" required/>
                        <input class="form-control" type="text" onclick="selectTitleTree()" id="treeName" readonly="true" th:field="*{parentName}">
                        <span class="input-group-addon" onclick="selectTitleTree()"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">网站展示目录名：</label>
                <div class="col-sm-8">
                    <input name="titleName" th:field="*{titleName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否展示：</label>
                <div class="col-sm-8">
                    <select name="ifShow" class="form-control" th:field="*{ifShow}" th:disabled="${websiteTitle.ifShow == 3?true:false}" required>
                            <option value="1">展示</option>
                            <option value="2">不展示</option>
                            <option value="3">默认展示,选择后不可再操作</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否有列表项：</label>
                <div class="col-sm-8">
                    <select name="isTwoleveltitle" class="form-control" th:field="*{isTwoleveltitle}" required>
                            <option value="1">包含列表项</option>
                            <option value="2">不包含列表项</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">排列顺序：</label>
                <div class="col-sm-8">
                    <input name="sortOrder" class="form-control" type="number" th:field="*{sortOrder}" required placeholder="顺序排列，数字小则在前，一级二级标题两个排列">
                    <!--<select name="order" class="form-control" required>
                        <option value="1">包含列表项</option>
                        <option value="2">不包含列表项</option>
                    </select>-->
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/title";
        $("#form-title-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-title-edit').serialize());
            }
        }

        /*网站首页展示目录-新增-选择父部门树*/
        function selectTitleTree() {
            var options = {
                title: '网站首页展示目录选择',
                width: "380",
                url: prefix + "/selectTitleTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>